/**
 * Created by yangfakuan on 2018/10/19.
 */
(function (t) {
    if (typeof define === "function" && define.amd) {
        define(["jquery"], t)
    } else {
        t(jQuery)
    }
})(function (t) {
    function i(t, i, e) {
        return t.replace(e || /\\?\{([^{}]+)\}/g, function (t, e) {
            var o = e.split(".");
            var s = i;
            for (var a = 0; a < o.length; a++) {
                s = typeof s == "object" ? s[o[a]] : null
            }
            return s === undefined ? "" : s
        })
    }

    function e(t) {
        if (typeof t == "string") {
            return t.replace(/<script>/g, "&lt;script&gt;").replace(/<\/script>/g, "&lt;/script&gt;")
        } else {
            return t
        }
    }

    var o = function (o) {
        var s = this;
        var a = {
            title: "Dialog",
            titleUnderline: false,
            btnLeft: {text: "btnLeft", fn: null},
            btnRight: {text: "btnRight", fn: null, color: null},
            html: "Dialog content...",
            beforeAction: function () {
            },
            beforeAppendTo: function () {
            },
            dialogStyle: "dialog",
            overlayClass: "global_black_overlay",
            actions: {}
        };
        var l = "<div>{html}</div>";
        var n = '<h3><div class="ellipsis" id="dialog_content" style="line-height: 18px;" title="{html}">{html}</div></h3>';
        var r = "";
        if (o.btnLeft && o.btnRight) {
            o.btnLeft.text = toUperCaseStr(o.btnLeft.text);
            o.btnRight.text = toUperCaseStr(o.btnRight.text);
            r = '    <div class="global_dialog_confirm_ft">' + '        <div class="dialog-left-btn-wrap l" id="dialog_leftBtn"><div class="global_dialog_confirm_nor" role="cancel"><span></span></div></div>' + '        <div class="dialog-right-btn-wrap r" id="dialog_rightBtn"><div class="global_dialog_confirm_nor" role="confirm" id="rightBtn_confirm"><span id="rightBtnText"></span><div class="errortip"></div></div></div>' + "    </div>"
        } else if (!o.btnLeft && o.btnRight) {
            o.btnRight.text = toUperCaseStr(o.btnRight.text);
            r = '    <div class="global_dialog_confirm_ft" id="dialog_rightBtn">' + '       <div id="dialogConfirmBtn" class="global_dialog_confirm_nor dialog-middle-btn-wrap" role="confirm"><span></span><div class="errortip"></div></div>' + "    </div>"
        }
        this.options = t.extend(a, o);
        this.options.html = e(this.options.html);
        var d = "";
        if ("tab" == this.options.dialogStyle) {
            d = '<div class="global_dialog_confirm_main_fullScreen" style="display: block;">' + '    <div class="global_dialog_confirm_title">' + '        <h3 class="ellipsis" id="dialog_title"></h3>' + "    </div>" + '    <div class="global_dialog_confirm_content">{content}</div>' + r + "</div>" + '<div class="' + this.options.overlayClass + '"></div>'
        } else {
            var f = "display: block;";
            if (this.options.width) {
                f = f + "width:" + this.options.width + ";"
            }
            if (this.options.height) {
                f = f + "height:" + this.options.height + ";"
            }
            if (this.options.top) {
                f = f + "top:" + this.options.top + ";"
            }
            if (this.options.left) {
                f = f + "left:" + this.options.left + ";"
            }
            d = '<div class="global_dialog_confirm_main" style="' + f + '">' + '    <div class="global_dialog_confirm_title">' + '        <h3 class="ellipsis" id="dialog_title"></h3>' + "    </div>" + '    <div class="global_dialog_confirm_content">{content}</div>' + r + "</div>" + '<div class="' + this.options.overlayClass + '"></div>'
        }
        if (/<.*?>/.test(o.html)) {
            this.options.content = i(l, this.options)
        } else {
            this.options.content = i(n, this.options)
        }
        this.dialogHtml = i(d, this.options);
        this.$dialogWrap = null;
        this.init = function () {
            this.$dialogWrap = t(this.dialogHtml);
            this.$mask = this.$dialogWrap.last();
            this.$dialog = this.$dialogWrap.first();
            this.$dialog.append('<div class="dialog-cancel" role="cancel2" id="dialog_cancel_btn"></div>');
            if (this.options.titleUnderline) {
                this.$dialog.find(".global_dialog_confirm_title h3").css({"text-decoration": "underline"})
            }
            this.$dialog.find("[title]").each(function () {
                var i = t(this).attr("title");
                if (/^\<.*?\>.*?\<.*?\>$/.test(i)) t(this).attr("title", t(i).text())
            });
            this.$dialog.on("click", "[role=confirm]", function (i) {
                i.stopPropagation();
                if (t(this).attr("disabled")) {
                    return
                }
                var e = s.options.btnRight.fn;
                if (typeof e == "function") {
                    e.call(s)
                }
            }).on("click", "[role=cancel]", function () {
                var t = s.options.btnLeft.fn;
                if (typeof t == "function") {
                    t.call(s)
                }
                s.$dialog.trigger("close")
            }).on("click", "[act]", function (i) {
                i.stopPropagation();
                var e = s.options.actions[t(this).attr("act")];
                if (typeof e == "function") {
                    e.call(s)
                }
            }).on("click", "[role=cancel2]", function () {
                var t;
                if (s.options.cancelFn) {
                    t = s.options.cancelFn
                } else if (s.options.btnLeft) {
                    t = s.options.btnLeft.fn
                }
                if (typeof t == "function") {
                    t.call(s)
                }
                s.$dialog.trigger("close")
            }).on("close", function () {
                s.hide()
            });
            this.$mask.on("selectstart", function () {
                return false
            }).on("mousedown", function () {
                return false
            })
        };
        this.show = function () {
            this.init();
            if (typeof this.options.beforeAppendTo == "function") {
                this.options.beforeAppendTo.call(this)
            }
            this.$dialogWrap.appendTo("body");
            this.$dialog.find(".global_dialog_confirm_title h3").attr("title", this.options.title);
            this.$dialog.find(".global_dialog_confirm_title h3").text(this.options.title);
            this.$dialog.find(".global_dialog_confirm_ft .dialog-left-btn-wrap>div").attr("title", (this.options.btnLeft || {}).text);
            this.$dialog.find(".global_dialog_confirm_ft .dialog-left-btn-wrap>div>span").text((this.options.btnLeft || {}).text);
            this.$dialog.find(".global_dialog_confirm_ft .dialog-right-btn-wrap>div").attr("title", (this.options.btnRight || {}).text);
            this.$dialog.find(".global_dialog_confirm_ft .dialog-right-btn-wrap>div>span").text((this.options.btnRight || {}).text);
            this.$dialog.find(".global_dialog_confirm_ft .dialog-middle-btn-wrap").attr("title", (this.options.btnRight || {}).text);
            this.$dialog.find(".global_dialog_confirm_ft .dialog-middle-btn-wrap>span").text((this.options.btnRight || {}).text);
            if ((this.options.btnRight || {}).color) {
                this.$dialog.find(".global_dialog_confirm_ft .dialog-right-btn-wrap>div>span").css("color", (this.options.btnRight || {}).color)
            }
            if (typeof this.options.beforeAction == "function") {
                this.options.beforeAction.call(this)
            }
            t("#login_password").blur();
            this.$dialogWrap.fadeIn(function () {
                if ("tab" != s.options.dialogStyle) {
                    i()
                }
                if (/msie\s+(7|8|9)/.test(navigator.userAgent.toLowerCase())) {
                    t("#passwdEye").remove()
                }
                function i() {
                    if (!s.$dialog.hasClass("global_dialog_confirm_main"))return;
                    var i = s.$dialog[0].scrollHeight;
                    var e = (t(window).height() - i) / 2;
                    if (e < 8) {
                        e = 8;
                        var o = t(window).height() - e * 2 - s.$dialog.find(".global_dialog_confirm_ft").outerHeight() - s.$dialog.find(".global_dialog_confirm_title").outerHeight() - s.$dialog.find(".global_dialog_confirm_content").css("padding-top").split("px")[0] * 1 - s.$dialog.find(".global_dialog_confirm_content").css("padding-bottom").split("px")[0] * 1 - 32;
                        if (o < 0) {
                            s.$dialog.css("overflow-y", "scroll")
                        } else {
                            s.$dialog.find(".global_dialog_confirm_content").height(o);
                            s.$dialog.find(".global_dialog_confirm_content").css("overflow-y", "scroll")
                        }
                        s.$dialog.css("bottom", e + "px");
                        s.$dialog.css("top", e + "px")
                    } else {
                        s.$dialog.css("overflow-y", "visible");
                        s.$dialog.find(".global_dialog_confirm_content").css("overflow-y", "visible");
                        s.$dialog.find(".global_dialog_confirm_content").height("auto");
                        s.$dialog.css("bottom", "auto");
                        s.$dialog.css("top", e + "px")
                    }
                }
            })
        };
        this.hide = function () {
            if (this.$dialogWrap && this.$dialogWrap.length > 0) {
                this.$dialogWrap.fadeOut(function () {
                    s.$dialogWrap.remove()
                })
            }
        };
        this.enable = function () {
            s.$dialog.find("[role=confirm]").removeAttr("disabled");
            s.$dialog.find("[role=confirm]").removeClass("globle_dialog_btn_disabled");
            s.$dialog.find("[role=confirm]").css({"cursor": "pointer"})
        };
        this.disabled = function () {
            s.$dialog.find("[role=confirm]").attr("disabled", true);
            s.$dialog.find("[role=confirm]").addClass("globle_dialog_btn_disabled");
            s.$dialog.find("[role=confirm]").css({"cursor": "auto"})
        };
        return this
    };
    t.fn.Dialog = function (i) {
        var e = this[0];
        if (!e) {
            return
        }
        if (typeof i == "string") {
            switch (true) {
                case i == "show":
                    e.dialog.show();
                    break;
                case i == "hide":
                    e.dialog.hide();
                    break;
                case i == "enable":
                    e.dialog.enable();
                    break;
                case i == "disabled":
                    e.dialog.disabled();
                    break;
                default:
                    alert("error param");
                    break
            }
        } else if (typeof i == "object") {
            e.dialog = new o(i);
            t(e).on("click", function () {
                if (t(this).attr("disabled")) {
                    return
                }
                this.dialog.show()
            })
        } else {
            alert("error param")
        }
        return this
    };
    var s = function (i) {
        var o = this;
        var s = {
            text: "", btnText: "", btnFn: function () {
                this.hide()
            }, btnColor: null, btnLeftText: null, dialogStyle: "dialog"
        };
        var a = "<div class='global_dialog_confirm_main'>";
        var l;
        this.options = t.extend(s, i);
        this.options.text = e(this.options.text);
        if ("tab" == this.options.dialogStyle) {
            a = "<div class='global_dialog_confirm_main_fullScreen'>"
        }
        this.init = function () {
            this.options.btnLeftText = toUperCaseStr(this.options.btnLeftText);
            this.options.btnText = toUperCaseStr(this.options.btnText);
            var i = a + "<div class='textArea center'>" + this.options.text + "</div>" + "<div class='btn-area' style='width:42%;margin:auto'><a class='btn-EMUI5-2' id='rightBtn' href='javascript:void(0)'></a></div></div>";
            if (this.options.btnLeftText) {
                i = a + "<div class='textArea'>" + this.options.text + "</div>" + "<div class='btn-area clearfloat'>" + "<a class='btn-EMUI5-2 l ' style='width:42%' id='leftBtn' href='javascript:void(0)'></a>" + "<a class='btn-EMUI5-2 r'  style='width:42%' id='rightBtn' href='javascript:void(0)'></a>" + "</div></div>"
            }
            i += "<div class='global_black_overlay'></div>";
            l = t(i);
            t("body").append(l);
            l.find("#rightBtn").text(this.options.btnText);
            l.find("#leftBtn").text(this.options.btnLeftText);
            if (this.options.btnColor) {
                l.find("#rightBtn").css("color", this.options.btnColor)
            }
            addCssActive(t(".btn-EMUI5-2"), "btn-EMUI5-2-active");
            t("#rightBtn", l).click(function () {
                o.options.btnFn.call(o)
            });
            t("#leftBtn", l).click(function () {
                o.hide()
            })
        };
        this.show = function () {
            this.init();
            return this
        };
        this.hide = function () {
            l.remove()
        };
        return this
    };
    t.fn.DialogSimple = function (t) {
        s.call(this, t);
        return this
    };
    var a = function (i, e) {
        var o = this;
        var s = {
            items: [{value: 0, label: "defaultValue", other: ""}], defaultValue: null, onChange: function () {
            }
        };
        this.selectHtml = '<input type="hidden">' + '<b class="dptick r"></b>' + '<span class="ar-eg"></span>' + '<ul class="dpmenu" style="display: none;z-index:1000;"></ul>';
        this.options = t.extend(s, i);
        this.init = function () {
            this.$obj = t(e).addClass("ddrop").append(this.selectHtml);
            var i = this.$obj.find(".dpmenu");
            i.parents(".global_dialog_confirm_main, .global_dialog_alert_main").css("overflow", "visible");
            var s = null;
            for (var a = 0; a < this.options.items.length; a++) {
                i.append("<li></li>");
                i.find("li:last").attr("data-other", this.options.items[a].other);
                i.find("li:last").attr("data-value", this.options.items[a].value);
                i.find("li:last").text(d(this.options.items[a].label));
                if (!this.options.defaultValue && this.options.defaultValue !== 0 && a == 0) {
                    s = this.options.items[a]
                } else if (this.options.defaultValue === this.options.items[a].value) {
                    s = this.options.items[a]
                }
            }
            if (!s) {
                s = this.options.items[0]
            }
            this.$obj.find("span").text(d(s.label));
            this.$obj.find("input").val(s.value);
            this.$obj.on("click", function () {
                var i = t(this).data("open");
                if (!i) {
                    t(this).children(".dpmenu").attr("tabindex", 0).fadeIn(300).focus();
                    t(this).data("open", true)
                }
            }).on("click", ".dpmenu > li", function () {
                var i = t(this).closest(".ddrop");
                if (typeof t(this).data("value") == "object") {
                    i.children("input").val(JSON.stringify(t(this).data("value")))
                } else {
                    i.children("input").val(t(this).data("value"))
                }
                i.children("span").text(t(this).text());
                t(this).parent().fadeOut(300, function () {
                    i.data("open", false)
                });
                if (typeof o.options.onChange == "function") {
                    o.options.onChange.call(o, t(this).data("value"), t(this).text(), t(this).data("other"))
                }
            }).on("blur", ".dpmenu", function () {
                t(this).fadeOut(300, function () {
                    t(this).parent().data("open", false)
                })
            })
        };
        this.selectValue = function (t) {
            var i = null;
            for (var e = 0; e < this.options.items.length; e++) {
                if (t === this.options.items[e].value) {
                    i = this.options.items[e]
                }
            }
            this.$obj.find("span").text(i.label);
            this.$obj.find("input").val(i.value)
        };
        return this
    };
    t.fn.DropList = function (t) {
        var i = this[0];
        if (typeof t == "string") {
            switch (true) {
                case t == "select":
                    i.droplist.selectValue(arguments[1]);
                    break;
                default:
                    alert("error param");
                    break
            }
        } else if (typeof t == "object") {
            i.droplist = new a(t, i);
            i.droplist.init()
        } else {
            alert("error param")
        }
        return this
    };
    var l = function (i, e) {
        var o = this;
        var s = {
            items: [{value: 0, label: "defaultValue", other: ""}],
            defaultValue: null,
            onChange: function () {
            },
            showDefaultValue: true,
            suffix: "",
            selShowSuffix: true,
            selectSpace: true,
            style: "auto",
            parent: "",
            dir: "down"
        };
        this.options = t.extend(s, i);
        this.selectHtml = '<input type="hidden">' + '<span class="select-text ar-eg"></span><span class="suffix" style="color:#999" >' + '</span><div class="select-ico"></div><ul class="dpmenu-EMU5" style="display:none;"></ul>';
        this.init = function () {
            this.$obj = t(e).addClass("ddrop-EMU5").html(this.selectHtml);
            this.$obj.find(".suffix").text(this.options.suffix);
            var i = this.options;
            var s = this;
            var l = this.$obj.find(".dpmenu-EMU5");
            this.$ul = l;
            var n = this.$obj.css("overflow");
            if (this.options.dir == "up") {
                l.addClass("dpmenu-EMUI5-up")
            } else {
                l.addClass("dpmenu-EMUI5-down")
            }
            var r = null;
            var d = this.options.items.length;
            l.append('<div class="flow-top"></div>');
            var f = a(this.options.items);
            if (this.options.style == "full") {
                this.options.parent.css("position", "relative");
                this.$obj.css("position", "static");
                f = this.options.parent.width() - 32;
                l.width(f + 32);
                l.css("min-width", f + 32);
                l.css("max-width", f + 32);
                l.css("left", "0");
                l.css("right", "0");
                var h = this.options.parent.height() + this.options.parent.css("padding-top").split("px")[0] * 1 + 8;
                l.css("top", h + "px")
            }
            if (d > 6) {
                l.css("overflow-y", "scroll");
                l.css("min-width", l.width() + 20 + "px");
                l.css("max-width", l.css("max-width").split("px")[0] * 1 + 20 + "px")
            }
            l.width(f + 32);
            for (var c = 0; c < d; c++) {
                if (c != d - 1) {
                    l.append("<li class='dropListEMUI5_li ar-eg'></li><div class='uc-line' style='width:" + f + "px'><div></div></div>");
                    l.find(".dropListEMUI5_li:last").text(this.options.items[c].label);
                    l.find(".dropListEMUI5_li:last").attr("data-other", this.options.items[c].other);
                    l.find(".dropListEMUI5_li:last").attr("data-value", this.options.items[c].value)
                } else {
                    l.append("<li class='dropListEMUI5_li ar-eg'></li>");
                    l.find(".dropListEMUI5_li:last").text(this.options.items[c].label);
                    l.find(".dropListEMUI5_li:last").attr("data-other", this.options.items[c].other);
                    l.find(".dropListEMUI5_li:last").attr("data-value", this.options.items[c].value)
                }
                if (!this.options.defaultValue && this.options.defaultValue !== 0 && c == 0) {
                    r = this.options.items[c]
                } else if (this.options.defaultValue == this.options.items[c].value) {
                    r = this.options.items[c]
                }
            }
            if (!r) {
                r = this.options.items[0]
            }
            if (d == 1 && !i.defaultText) {
                r = this.options.items[0];
                this.$obj.find(".select-ico").addClass("select-ico-gray")
            }
            if (!this.options.showDefaultValue) {
                if (this.options.selectSpace) {
                    this.$obj.find(".select-text").text(r ? r.label : "").css("visibility", "hidden")
                }
                this.$obj.find("input").val(r ? r.value : "")
            } else {
                this.$obj.find(".select-text").text(r ? r.label : "");
                this.$obj.find("input").val(r ? r.value : "");
                this.$obj.find(".suffix").css("color", "#333")
            }
            if (i.showday && !i.selShowSuffix && this.$obj.find(".select-text").css("visibility") != "hidden") {
                this.$obj.find(".suffix").text("")
            }
            if (i.defaultText) {
                this.$obj.find(".select-text").text(i.defaultText);
                this.$obj.find("input").val("")
            }
            this.$obj.unbind();
            var p = false;
            this.$obj.on("click", function () {
                if (p) {
                    p = false;
                    return
                }
                if (d == 1 && !i.defaultText || t(this).hasClass("ddrop-disabled"))return;
                var e = t(this).data("open");
                if (!e) {
                    s.$obj.css("overflow", "visible");
                    t(this).children(".dpmenu-EMU5").attr("tabindex", 0).show().focus();
                    t(this).data("open", true);
                    if (s.options.style == "full") {
                        var o = s.options.parent.height() + s.options.parent.css("padding-top").split("px")[0] * 1 + 8;
                        l.css("top", o + "px")
                    }
                } else {
                    s.$obj.css("overflow", n)
                }
            }).on("click", ".dpmenu-EMU5 > li", function (e) {
                e.stopPropagation();
                s.$obj.css("overflow", n);
                var a = t(this).closest(".ddrop-EMU5");
                if (typeof t(this).data("value") == "object") {
                    a.children("input").val(JSON.stringify(t(this).data("value")))
                } else {
                    a.children("input").val(t(this).data("value"))
                }
                a.children(".select-text").text(t(this).text()).css("visibility", "visible");
                if (!i.selShowSuffix) {
                    a.children(".suffix").text("")
                }
                t(this).parent().hide();
                a.data("open", false);
                if (typeof o.options.onChange == "function") {
                    o.options.onChange.call(o, t(this).data("value"), t(this).text(), t(this).data("other"))
                }
                a.children(".suffix").css("color", "#333")
            }).on("blur", ".dpmenu-EMU5", function () {
                p = true;
                t(this).hide();
                t(this).parent().data("open", false);
                s.$obj.css("overflow", n)
            });
            this.$obj.find(".dpmenu-EMU5")[0].onmousewheel = function (t) {
                if (!t) t = window.event;
                this.scrollTop = this.scrollTop - (t.wheelDelta ? t.wheelDelta : -t.detail * 10);
                return false
            };
            t(document).bind("click", function () {
                p = false
            });
            addItemActive(t(".dpmenu-EMU5 > li", this.$obj), "li-active")
        };
        this.selectValue = function (t) {
            var i = null;
            for (var e = 0; e < this.options.items.length; e++) {
                if (t == this.options.items[e].value) {
                    i = this.options.items[e]
                }
            }
            this.$obj.find(".select-text").text(i.label).css("visibility", "visible");
            this.$obj.find(".suffix").css("color", "#333");
            this.$obj.find("input").val(i.value)
        };
        function a(i) {
            var e = 104;
            var o;
            var s;
            for (var a = 0; a < i.length; a++) {
                o = '<span id="contLength" style="visibility:hidden;font-size:15px;"></span>';
                t("body").append(o);
                t("#contLength:last").text(i[a].label);
                s = t("#contLength")[0].offsetWidth + 1;
                if (s > e) e = s;
                t("#contLength").remove()
            }
            return e
        }

        return this
    };
    t.fn.DropListEMUI5 = function (t) {
        var i = this[0];
        if (!i) {
            return
        }
        if (typeof t == "string") {
            switch (true) {
                case t == "select":
                    i.droplistEMUI5.selectValue(arguments[1]);
                    break;
                default:
                    alert("error param");
                    break
            }
        } else if (typeof t == "object") {
            i.droplistEMUI5 = new l(t, i);
            i.droplistEMUI5.init()
        } else {
            alert("error param")
        }
        return this
    };
    var n = function (i, e) {
        var o;
        var s;
        var a;
        var l;
        var n;
        var r;
        var d = {
            yearChange: function () {
            },
            monthChange: function () {
            },
            dayChange: function () {
            },
            format: "Y-M-D",
            yearSuffix: "",
            monthSuffix: "",
            daySuffix: "",
            itemSuffix: false,
            yearSpace: true,
            monthSpace: true,
            daySpace: true,
            dir: "down"
        };
        this.init = function () {
            i = t.extend(d, i);
            var u = "<div> <input class='year' type='hidden'  /><input class='month' type='hidden' /> <input class='day' type='hidden'> <div class='yearDiv dateItems'></div> <div class='monthDiv dateItems'></div> <div class='dayDiv dateItems'> </div></div>";
            var g = e;
            g.html(u);
            o = t(".dayDiv", g);
            s = t(".monthDiv", g);
            a = t(".yearDiv", g);
            l = t(".day", g);
            n = t(".year", g);
            r = t(".month", g);
            l.val("N");
            n.val("N");
            r.val("N");
            var v = f();
            var b = h();
            var m = c(2016, 1);
            var x = true;
            if (localInfo.lang != "zh-cn" && localInfo.lang != "zh-hk" && localInfo.lang != "zh-tw") {
                x = false
            }
            if (i.format.indexOf("Y") != -1) {
                a.DropListEMUI5({
                    items: v,
                    defaultValue: "N",
                    showDefaultValue: false,
                    suffix: i.yearSuffix,
                    selShowSuffix: x,
                    selectSpace: i.yearSpace,
                    onChange: function (t, e) {
                        n.val(t);
                        p(x);
                        i.yearChange()
                    },
                    dir: i.dir
                })
            }
            if (i.format.indexOf("M") != -1) {
                s.DropListEMUI5({
                    items: b,
                    defaultValue: "N",
                    showDefaultValue: false,
                    suffix: i.monthSuffix,
                    selShowSuffix: x,
                    selectSpace: i.monthSpace,
                    onChange: function (t, e) {
                        r.val(t);
                        p(x);
                        i.monthChange()
                    },
                    dir: i.dir
                })
            }
            if (i.format.indexOf("D") != -1) {
                o.DropListEMUI5({
                    items: m,
                    defaultValue: "N",
                    showDefaultValue: false,
                    suffix: i.daySuffix,
                    selShowSuffix: x,
                    selectSpace: i.daySpace,
                    onChange: function (t, e) {
                        l.val(t);
                        i.dayChange()
                    },
                    dir: i.dir
                })
            }
        };
        this.getValue = function (t) {
            if (t == "Y") {
                return n.val() * 1
            } else if (t == "M") {
                return r.val() * 1
            } else if (t == "D") {
                return l.val() * 1
            }
        };
        this.setDate = function (t, i, e) {
            t = t || 1900;
            i = i || 1;
            e = e || 1;
            a.DropListEMUI5("select", t);
            s.DropListEMUI5("select", i);
            o.DropListEMUI5("select", e);
            l.val(e);
            n.val(t);
            r.val(i)
        };
        function f() {
            var t = (new Date).getFullYear();
            var e = [];
            for (var o = t; o >= 1900; o--) {
                if (i.itemSuffix) {
                    t = {value: o, label: o + i.yearSuffix}
                } else {
                    t = {value: o, label: o + ""}
                }
                e.push(t)
            }
            return e
        }

        function h() {
            var t = [];
            var e = {};
            for (var o = 1; o <= 12; o++) {
                if (i.itemSuffix) {
                    e = {value: o, label: o + i.monthSuffix}
                } else {
                    e = {value: o, label: o + ""}
                }
                t.push(e)
            }
            return t
        }

        function c(t, e) {
            var o = [30, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
            if (e == 2 && t % 400 == 0 || t % 4 == 0 && t % 100 != 0) {
                o[2] = 29
            }
            var s = [];
            var a = {};
            for (var l = 1; l <= o[e]; l++) {
                if (i.itemSuffix) {
                    a = {value: l, label: l + i.daySuffix}
                } else {
                    a = {value: l, label: l + ""}
                }
                s.push(a)
            }
            return s
        }

        function p(t) {
            if (i.format.indexOf("D") == -1)return;
            var e = n.val() * 1;
            var s = r.val() * 1;
            var a = l.val();
            var d = c(e, s);
            var f = false;
            if (a != "N") {
                f = true;
                if (a * 1 > d.length) {
                    a = 1
                }
            }
            if (!isNaN(e) && !isNaN(s)) {
                o.DropListEMUI5({
                    items: d,
                    defaultValue: a,
                    suffix: i.daySuffix,
                    showDefaultValue: f,
                    selShowSuffix: t,
                    showday: true,
                    onChange: function (t, e) {
                        l.val(t);
                        i.dayChange()
                    },
                    dir: i.dir
                })
            }
        }
    };
    t.fn.datePickEMUI5 = function (i) {
        var e = this[0];
        if (!e) {
            return
        }
        if (typeof i == "object") {
            e.datePickEMUI5 = new n(i, t(e));
            e.datePickEMUI5.init()
        } else if (typeof i == "string") {
            return e.datePickEMUI5.getValue(i)
        } else if (typeof i == "number") {
            e.datePickEMUI5.setDate.apply(e.datePickEMUI5, arguments)
        }
    };
    t(document).on("click", ".radio", function () {
        if (t(this).data("check")) {
            return
        }
        var i = t(this).data("group");
        r(t(this), true);
        r(t("[data-group='" + i + "']").not(this), false);
        t("#" + i).val(t(this).data("value"));
        t("#" + i).trigger("change")
    }).on("check", ".radio", function () {
        t(this).trigger("click")
    });
    function r(t, i) {
        if (i) {
            t.removeClass("roff").addClass("ron")
        } else {
            t.removeClass("ron").addClass("roff")
        }
        t.data("check", i)
    }

    function d(t) {
        if (t.length > 28) {
            if (t.indexOf("*") > 0) {
                var i = t.substring(0, t.indexOf("*"));
                var e = t.substring(t.lastIndexOf("*"), t.length);
                i = i.substring(0, 24 - e.length);
                t = i + "****" + e
            }
        }
        return t
    }
});